package hwang.com.logpritice;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
    private static final String ACTIVITY_TAG="LogDemo";
    private Button button;
        public void onCreate(Bundle savedInstanceState){
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            //通过findViewById找到Button资源
            button = (Button)findViewById(R.id.button);
            //增加事件响应
            button.setOnClickListener(new Button.OnClickListener(){
                @Override
                public void onClick(View v){
                    Log.v(MainActivity.ACTIVITY_TAG,"this is Verbose");
                    Log.d(MainActivity.ACTIVITY_TAG,"this is Debug");
                    Log.i(MainActivity.ACTIVITY_TAG,"this is information");
                    Log.w(MainActivity.ACTIVITY_TAG,"this is warning");
                    Log.e(MainActivity.ACTIVITY_TAG,"this is error");

                }
            });
        }
}
